package com.xiaobaibai.vo;

import com.xiaobaibai.entity.BargainUser;
import com.xiaobaibai.entity.Product;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class BargainOrderVo {

    private Integer bargainUserId;

    private Integer productId;

    private Double bargainProgress;

    private Date createTime;

    private String productImage;

    private String productName;

    private BigDecimal productPrice;

    public static BargainOrderVo convertProductAndBargain(Product product, BargainUser bargainUser){
        BargainOrderVo bargainOrderVo=new BargainOrderVo();
        bargainOrderVo.setBargainUserId(bargainUser.getId());
        bargainOrderVo.setProductId(bargainUser.getProductId());
        bargainOrderVo.setCreateTime(bargainUser.getCreateTime());
        bargainOrderVo.setProductImage(product.getProductImage().get(0));
        bargainOrderVo.setProductName(product.getProductName());
        bargainOrderVo.setProductPrice(product.getProductPrice());
        bargainOrderVo.setBargainProgress(bargainUser.getBargainProgress());
        return bargainOrderVo;
    }

}
